package com.dream.keigezhushou.Activity.pop;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.dream.keigezhushou.R;


/**
 *
 *   弹窗
 */

public class PoupWindow extends DialogBase {



    private Context context;

    private ItemClickListener itemClickListener;
    private final RelativeLayout rlSetRing;
    private final RelativeLayout rlSetClock;
    private final RelativeLayout rlShare;
    private final RelativeLayout rlDelte;


    /**
     * @param contentView
     * @param context
     * @param width
     * @param height      设置高度
     */
    public PoupWindow(final View contentView, final Context context, int width, int height) {
        super(contentView, context, width, height);
        this.context = context;

        rlSetRing = (RelativeLayout) contentView.findViewById(R.id.rl_set_ring);
        rlSetClock = (RelativeLayout) contentView.findViewById(R.id.rl_set_clock);
        rlShare = (RelativeLayout) contentView.findViewById(R.id.rl_share);
        rlDelte = (RelativeLayout) contentView.findViewById(R.id.rl_delete);
        rlSetRing.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (itemClickListener != null) {
                    itemClickListener.onClick();
                }
                dismiss();

            }
        });


        rlSetClock.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (itemClickListener != null) {
                    itemClickListener.onClick();
                }
                dismiss();

            }
        });


        rlDelte.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (itemClickListener != null) {
                    itemClickListener.onClick();
                }
                dismiss();

            }
        });
        rlShare.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//
                if (itemClickListener != null) {
                    dismiss();
                    itemClickListener.onSingDetail();

                }


            }
        });


    }


    public void setItemListener(ItemClickListener itemClickListener) {

        this.itemClickListener = itemClickListener;
    }


    public interface ItemClickListener {

        public void onClick();

        public void onSingDetail();
    }


}
